module zysx {
	/**
	 *
	 * @author Don
	 *
	 */
	export class BaseView extends BaseComponent {
		private _isShow: boolean;

		public resName: string;      //模块所引用的资源组
		public constructor(data?: any) {
			super(data);
		}
		/**
		 * 浏览器尺寸变化，响应
		 */
		protected onStageResize(evt?: egret.Event): void {
			this.width = zysx.StageMgr.stageWidth;
			this.height = zysx.StageMgr.stageHeight;
		}
		/**
		 * @description 
		 */
		protected initComponent(): void {
			super.initComponent();
		}

		protected initListener(): void {
			super.initListener();
			if (this["close_btn"]) {
				this.addEvent(this["close_btn"], egret.TouchEvent.TOUCH_TAP, this.closeSelf, this);
			}
		}
		protected onOpen(data?: any): void {
			super.onOpen(data);
			this.onStageResize();
			if (this["content"]) {
				this["content"].scaleX = 0.5;
				this["content"].scaleY = 0.5;
				egret.Tween.get(this["content"]).to({ scaleX: 1, scaleY: 1 }, 300, egret.Ease.backOut);
			}
		}
		public get isShow(): boolean {
			return this._isShow;
		}
		public onClose(): void {
			this._isShow = false;
			if (this["content"]) {
				egret.Tween.get(this["content"]).to({ scaleX: 0.5, scaleY: 0.5 }, 300, egret.Ease.backIn).call(() => {
					super.onClose();
				}, this);
			} else {
				super.onClose();
			}
		}
		public closeSelf(): void {
			LayerMgr.ins.closeViewByTarget(this);
		}
	}
	egret.registerClass(BaseView, "BaseView");
}
